package com.cwj.film.configuration;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;


@Component  //自动更新日期
public class MyMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {

        strictInsertFill(metaObject, "uploadTime", Date.class,new Date()); // 起始版本 3.3.0(推荐使用)
        strictInsertFill(metaObject,"downloadTime",Date.class,new Date());
        strictInsertFill(metaObject,"WatchTime",Date.class,new Date());
        strictInsertFill(metaObject,"folderTime",Date.class,new Date());
     }

    @Override
    public void updateFill(MetaObject metaObject) {

    }

}
